/*
 * @Author: your name
 * @Date: 2021-10-07 16:21:26
 * @LastEditTime: 2023-08-20 19:18:54
 * @LastEditors: 周林军 1799198652@qq.com
 * @Description: In User Settings Edit
 * @FilePath: \ABC\block\Speech recognition.js
 */
'use strict';
goog.provide('Blockly.Blocks.Speech recognition');
goog.require('Blockly.Blocks');
var YU_YIN=[["开灯", "1"],["关灯", "2"],["调为红色", "3"],["调为蓝色", "4"],["调为绿色", "5"],
["调为彩色", "6"],["打开空调", "7"],["关闭空调", "8"],["打开风扇", "9"],["关闭风扇", "16"],
["1档风", "17"],["2档风", "18"],["3档风", "19"],["自动模式", "20"],["制冷模式", "21"],
["制热模式", "22"],["升高温度", "23"],["降低温度", "24"],["打开台灯", "25"],["关闭台灯", "32"],
["调到最亮", "33"],["调到最暗", "34"],["调亮一点", "35"],["调暗一点", "36"],["查询温度", "37"],
["查询湿度", "38"],["查询天气", "39"],["前进", "40"],["后退", "41"],["左转", "48"],
["右转", "49"],["停止", "50"],["查询时间", "51"],["播放音乐", "52"],["上一首", "53"],
["下一首", "54"],["开始", "55"],["暂停", "56"],["自定义词一", "57"],["自定义词二", "64"],["自定义词三", "65"],["自定义词四", "66"]
,["自定义词五", "67"],["自定义词六", "68"],["自定义词七", "69"],["自定义词八", "70"],["自定义词九", "71"],["自定义词十", "72"]
];
var YU_BO=[["现在的温度是", "1"],["度", "2"],["现在的湿度是百分之", "3"],["一", "4"],["二", "5"],
["三", "6"],["四", "7"],["五", "8"],["六", "9"],["七", "10"],
["八", "11"],["九", "12"],["十", "13"],["个", "14"],["百", "15"],["千", "16"],
["万", "17"],["亿", "18"],["点", "19"],["负", "20"],["零", "21"],
["现在的时间是", "22"],["年", "23"],["月", "24"],["日", "25"],["点", "26"],
["分", "27"],["秒", "28"],["百分之", "29"],["现在的距离是", "30"],["毫米", "31"],["厘米", "32"],
["米", "33"],["千米", "34"]
];

Blockly.Blocks.yuyininit = {
  init: function() {
    this.setColour(120);
    this.appendDummyInput("")
      .appendField("初始化语音识别模块")
	this.appendDummyInput("")
	    .appendField(new Blockly.FieldDropdown([["软串口", "1"],["硬串口", "2"]]), "mode");
	this.appendDummyInput("")
      .appendField("RX为")
    this.appendValueInput("PIN1", Number)
        .setCheck(Number);
    this.appendDummyInput("")
      .appendField("TX为")
    this.appendValueInput("PIN2", Number)
      .setCheck(Number);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};

//特定10进制指令词
Blockly.Blocks.yuyinshibie = {
  init: function() {
    this.setColour(230);
    this.appendDummyInput("")
	    .appendField(new Blockly.FieldDropdown(YU_YIN), "PIN");
	this.appendDummyInput("")
		.appendField("指令")
    this.setOutput(true, Number);
	this.setInputsInline(true);
    this.setTooltip('特定指令词，需刷指定的固件，指令已转为10进制');
   // this.setPreviousStatement(true);
    //this.setNextStatement(true);
  }
};


//识别到16进制指令词
Blockly.Blocks.yuyinshibie1 = {
  init: function() {
    this.setColour(120);
	this.appendValueInput("VALUE")
	    .setCheck(Number)
	    .appendField("识别到")
	this.setOutput(true, Boolean);
	//this.setInputsInline(true);
    this.setTooltip('识别到特定的指令词，也可根据需要设置16进制指令，例如：0x40');
  }
};






Blockly.Blocks.yuyinqinchu = {
  init: function() {
    this.setColour(120);
    this.appendDummyInput("")
	    .appendField("清除识别结果")
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};
Blockly.Blocks.yuyinshuaxin = {
  init: function() {
    this.setColour(120);
    this.appendDummyInput("")
	    .appendField("刷新识别结果")
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};
Blockly.Blocks.boxiaoshu = {
  init: function() {
    this.setColour(120);
    this.appendDummyInput("")
	    .appendField("播报小数")
    this.appendValueInput("XIAOSHU")
      .setCheck(null)
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};
Blockly.Blocks.bozhenshu = {
  init: function() {
    this.setColour(120);
    this.appendDummyInput("")
	    .appendField("播报整数")
    this.appendValueInput("ZHENSHU")
      .setCheck(null)
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};
Blockly.Blocks.yuyinbobao = {
  init: function() {
    this.setColour(120);
    this.appendDummyInput("")
	    .appendField("播报")
	    .appendField(new Blockly.FieldDropdown(YU_BO), "PIN3");
    this.setInputsInline(true);
   // this.setTooltip('');
   // this.setOutput(true, Boolean);
    // this.setTooltip('');
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};
